import time
import pygame
from pygame.sprite import Sprite

file = r'music\bg1.mp3'
pygame.mixer.init()
class music(Sprite ):
   def __init__(self):
      file = r'music\bg1.mp3'

   #游戏背景音乐
   def bg(self):

      print("播放音乐1")
      pygame.mixer.music.load(file)

      pygame.mixer.music.play(-1)
     # time.sleep(10)
   #飞机开火音乐
   def shoot(self):
      # pygame.mixer.init()
       sound=pygame.mixer.Sound(r'music\shoot1.wav')
       sound.play()
   #外星人到屏幕底，或者和飞机碰撞的声音
   def gameoover(self):
      # pygame.mixer.init()
       sound = pygame.mixer.Sound(r'music\break.wav')
       sound.play()

   